import Vue from 'vue';
import Vuex from 'vuex';

Vue.use(Vuex);

export const store = new Vuex.Store({
    state:{   //设置状态
        login:true
    },
    getters:{       //获取状态
        login:state => {
            return state.login
        }
    },
    mutations:{     //修改状态
        checkLogin:(state,payload) => {
            state.login = payload;  //commit
        }
    },
    actions:{       //异步操作
        checkLogin:({commit},playload) => {  //dispatch
            commit('checkLogin',playload);
        }
    }
})